import { devopsTipsUpdate, readTipsUpdate } from '@/services/api/api-devpos';
import { Modal } from 'antd';
import { useEffect, useState } from 'react';
import { useModel } from '@umijs/max';

const DevopsTipsUpdateModule: React.FC = ({}) => {
  const { initialState } = useModel('@@initialState');
  const { currentUser } = initialState || {};

  /**
   * 市级部门
   */
  const [data, setDataState] = useState<any>();

  useEffect(() => {
    loadData();
  }, []);

  /**
   * 排行榜
   */
  const loadData = async () => {
    try {
      const response = await devopsTipsUpdate({ accountId: currentUser?.id });
      if (response.code == 0 && response.data.state == 1) {
        console.log('======');

        Modal.info({
          style: {
            marginTop: '180px',
          },
          title: response.data.title,
          content: (
            <div>
              <p>{response.data.content}</p>
            </div>
          ),
          async onOk() {
            await readTipsUpdate({ id: response.data.id, accountId: currentUser?.id });
          },
        });
      }
    } catch (error) {}
  };

  return <></>;
};

export default DevopsTipsUpdateModule;
